package com.sky.controller.user;

import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: CategoryController
 * Package: com.sky.controller.user
 * Description:
 *
 * @Author 八云
 * @Create 2025/3/22 23:47
 * @Version 1.0
 */

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Api(tags = "分类相关接口")
@Slf4j
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 分类查询
     * @param type
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("分类查询")
    @Cacheable("dishCache")
    public Result list(Integer type) {
        log.info("查询分类：{}", type);
        return Result.success(categoryService.list(type));
    }

}
